package kr.pe.johnkim.pushchat.mobile.dao;

import kr.pe.johnkim.pushchat.mobile.domain.PushChatRecommendation;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

/**
 * @author : John_Kim <cale9797@gmail.com>
 * @date : 13. 7. 4.
 */
@Repository
public class PushChatRecommendationDaoImpl extends SqlSessionDaoSupport implements PushChatRecommendationDao {

    // SLF4J Logging
    private Logger logger = LoggerFactory.getLogger(PushChatCertificationDaoImpl.class);

    /**
     * 좋아요 중복을 확인 한다.
     *
     * @param pushChatRecommendation
     * @return
     */
    @Override
    public PushChatRecommendation selectDuplicationRecommendation(PushChatRecommendation pushChatRecommendation) {
        logger.info("selectDuplicationRecommendation");
        return (PushChatRecommendation)this.getSqlSession().selectOne("PUSHCHAT_RECOMMENDATION.selectDuplicationRecommendation", pushChatRecommendation);
    }

    /**
     * 좋아요를 등록 한다.
     *
     * @param pushChatRecommendation
     */
    @Override
    public void registerRecommendation(PushChatRecommendation pushChatRecommendation) {
        logger.info("registerRecommendation");
        this.getSqlSession().insert("PUSHCHAT_RECOMMENDATION.registerRecommendation", pushChatRecommendation);
    }
}
